//    Copyright (C) Kherty.  All rights reserved.
using System.Diagnostics;
using System.Diagnostics.Contracts;
using OpenLS.Core;

namespace OpenLS.Spreadsheet
{
    class AddedCellUndoUnit: IUndoUnit
    {
        public AddedCellUndoUnit(Cell cell)
        {
            Contract.Requires(cell != null);
            this._cell = cell;
        }

        readonly Cell _cell;
        #region IUndoUnit Members

        public void Do()
        {
#if DEBUG
            Contract.Assert(_cell.Worksheet.Cells.Contains(_cell));
#endif
            _cell.Worksheet.RemoveCell(_cell);
        }

        public bool Merge(IUndoUnit unit)
        {
            return false;
        }

        #endregion
    }
}
